<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>详情页</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel='stylesheet' href='/stylesheets/signin.css' />
    <script type="text/javascript" src="/javascripts/xheditor/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/javascripts/xheditor/xheditor-1.2.2.min.js"></script>
    <script type="text/javascript" src="/javascripts/xheditor/xheditor_lang/zh-cn.js"></script>
    <style>
        .pad{
            padding-top: 50px;
        }
    </style>
</head>
<body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/">首页</a>
        </div>
        <div id="navbar" class=" navbar-right">
            <%if(!data.phone){%>
              <a class="navbar-brand" href="/login">登录</a>
              <a class="navbar-brand" href="/register">注册</a>
            <%}else{%>
              <a class="navbar-brand">你好：<%= data.phone %></a>
              <a class="navbar-brand" href="/logout">退出</a>
            <%}%>
        </div>
      </div>
    </nav>

    <div class="pad"></div>
    <div class="container">
        <div class="col-md-4">
            <div class="thumbnail">
            <img src="<%=data.det.images.large%>">
            <div class="caption">
                <h3><%=data.det.title%></h3>
                <p><%=data.det.summary%></p>
            </div>
            </div>
        </div>
        <div class="col-md-4">
            <form action="/movie/comment" method="post">
                <input type="text" name="imgid" value="<%=data.det.id%>" style="display:none">
                <textarea rows="30" cols="100"  id="content"  name="content"></textarea>
                <br/>
                <input type="submit" value="评论">
            </form>
        <div>
    </div>
    
    <%data.comment.forEach(function(item,index){%>
    <div>
        <p><span>评论：</span><%=item.content%></p>
    </div>
    <%})%>

    <script type="text/javascript">
        $(pageInit);
        function pageInit()
        {
            $.extend(XHEDITOR.settings,{shortcuts:{'ctrl+enter':submitForm}});
            $('#content').xheditor({
            html5Upload:false,
            upMultiple:"1",
            
            upLinkUrl:"upload.php",
            upLinkExt:"zip,rar,txt",
            
            upImgUrl:"/uploadImg",
            upImgExt:"jpg,jpeg,gif,png",
            
            upFlashUrl:"upload.php",
            upFlashExt:"swf",
            
            upMediaUrl:"upload.php",
            upMediaExt:"wmv,avi,wma,mp3,mid"
            });

        }
        function insertUpload(arrMsg)
        {console.log(arrMsg)
            var i,msg;
            for(i=0;i<arrMsg.length;i++)
            {
                msg=arrMsg[i];
                $("#uploadList").append('<option value="'+msg.id+'">'+msg.localname+'</option>');
            }
        }
        function submitForm(){$('#frmDemo').submit();}
    </script>
</body>
</html>